import { observable, action, autorun, toJS } from 'mobx';
import * as  Apis from '../../../apis/project';
import { message } from 'antd';
import { WeaLocaleProvider } from "ecCom"
const getLabel = WeaLocaleProvider.getLabel;

export class PrjResourceStore {

    @observable prjid = "";
    @observable resourceInfo = {
		cptList : [],
		prjList : [],
		taskList : [],
		accList : [],
		wfList : [],
		cusList : [],
		docList : []
    }
    @observable loading = false;
    
    initDatas = (prjid) => {
        this.prjid = prjid;
        this.getPrjResourceInfo();
    }

    getPrjResourceInfo = (params) => {
		this.loading = true;
		let newParams = { prjid: this.prjid, ...params };
		Apis.getPrjResources(newParams).then(data => {
			if(data.success){
				this.resourceInfo = {
					...data
				}
			}
			this.loading = false;
		})
	}
}